Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ISOP expression printing to print.hpp #135

Merged
merged 1 commit into from
Mar 27, 2024
Merged

Conversation

brainkz
Copy link
Contributor

@brainkz brainkz commented Mar 1, 2024

SOP expressions are useful when constructing the GENLIB library for technology mapping. The functions print_sop_expression and to_sop_expression convert the complete truth table and produce the SOP expression, e.g., (b&c)|(a&c)|(a&b) for majority-3.

Copy link
Owner

@msoeken msoeken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I left some small comments that should be addressed before merging.

test/print.cpp Outdated
@@ -168,4 +168,4 @@ TEST_F( PrintTest, print_kmap )
}
}
infile.close();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be reverted, as we expect an empty line at the end of every file.

include/kitty/print.hpp Outdated Show resolved Hide resolved
include/kitty/print.hpp Outdated Show resolved Hide resolved
include/kitty/print.hpp Outdated Show resolved Hide resolved
bool brackets = (__builtin_popcount(mask) > 1);

if (!first_cube)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the formatting for this library we expect spaces after opening and before closing parentheses.

include/kitty/print.hpp Outdated Show resolved Hide resolved
SOP expressions are useful when constructing the GENLIB library for technology mapping
@brainkz
Copy link
Contributor Author

brainkz commented Mar 26, 2024

Updated my pull request according to the requested changes:

  • No brackets around RHS
    bool brackets = __builtin_popcount( mask ) > 1;

  • Run clang-format to correct formatting, particularly:
    void print_sop_expression( TT tt, std::ostream& os = std::cout )
    for ( auto cube : cubes )
    if ( !first_cube )

  • Removed empty line before include

#include "algorithm.hpp"
#include "karnaugh_map.hpp"
#include "operations.hpp"
#include "constructors.hpp"
#include "isop.hpp"
  • Reverted changes in print.cpp

@msoeken msoeken merged commit 5b7ea89 into msoeken:master Mar 27, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants